<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SOAP Echo Service Documentation</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f5f5f5;
            padding: 2rem;
        }
        h1, h2 {
            color: #2c3e50;
        }
        pre {
            background-color: #ecf0f1;
            padding: 1rem;
            border-radius: 5px;
            overflow-x: auto;
        }
        code {
            font-family: Consolas, "Courier New", monospace;
        }
        ul {
            line-height: 1.8;
        }
        .note {
            background-color: #e7f3fe;
            border-left: 6px solid #2196F3;
            margin: 1rem 0;
            padding: 1rem;
        }
        a {
            text-decoration: none;
            color: #2980b9;
            font-size: 1.2rem;
            font-weight: bold;
        }
        a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <a href="soap-services.html">SOAP Services Home Page</a>
    <h1>SOAP Echo Service Documentation</h1>
    <p>
        The <strong>SOAP Echo Service</strong> receives a message and returns the same message in the response. 
        It is useful to verify if requests are handled correctly and to test SOAP-based communication.
    </p>

    <h2>Endpoint</h2>
    <pre><code>POST /webservices/soap/ws-echo.php</code></pre>

    <h2>SOAP Request Structure</h2>
    <p>Below is the SOAP request body that you can use:</p>
    <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:echowsdl"&gt;
   &lt;soapenv:Header/&gt;
   &lt;soapenv:Body&gt;
      &lt;urn:echoMessage&gt;
         &lt;message&gt;Hello, world!&lt;/message&gt;
      &lt;/urn:echoMessage&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</code></pre>

    <h2>Using Burp Repeater</h2>
    <p>To send the SOAP request using Burp Repeater:</p>
    <pre><code>POST /webservices/soap/ws-echo.php HTTP/1.1
Host: mutillidae.localhost
Content-Type: text/xml;charset=UTF-8
SOAPAction: "urn:echowsdl#echoMessage"
Content-Length: [length]

&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:echowsdl"&gt;
   &lt;soapenv:Header/&gt;
   &lt;soapenv:Body&gt;
      &lt;urn:echoMessage&gt;
         &lt;message&gt;Hello, world!&lt;/message&gt;
      &lt;/urn:echoMessage&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</code></pre>

    <h2>Using <code>curl</code></h2>
    <p>Here’s the same request using <code>curl</code>:</p>
    <pre><code>curl -X POST "http://mutillidae.localhost/webservices/soap/ws-echo.php" \
-H "Content-Type: text/xml; charset=UTF-8" \
-H "SOAPAction: \"urn:echowsdl#echoMessage\"" \
--data '&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:echowsdl"&gt;
   &lt;soapenv:Header/&gt;
   &lt;soapenv:Body&gt;
      &lt;urn:echoMessage&gt;
         &lt;message&gt;Hello, world!&lt;/message&gt;
      &lt;/urn:echoMessage&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;'</code></pre>

    <h2>Expected Response</h2>
    <p>The server will return the following SOAP response:</p>
    <pre><code>&lt;?xml version="1.0"?&gt;
&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;
   &lt;soapenv:Body&gt;
      &lt;urn:echoMessageResponse&gt;
         &lt;message&gt;Hello, world!&lt;/message&gt;
      &lt;/urn:echoMessageResponse&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</code></pre>

    <h2>Handling Errors</h2>
    <p>If an error occurs, the server will return a fault message like this:</p>
    <pre><code>&lt;?xml version="1.0"?&gt;
&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;
   &lt;soapenv:Body&gt;
      &lt;soapenv:Fault&gt;
         &lt;faultcode&gt;Server&lt;/faultcode&gt;
         &lt;faultstring&gt;SOAP Service Error: [Error Message]&lt;/faultstring&gt;
      &lt;/soapenv:Fault&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</code></pre>

    <div class="note">
        <strong>Troubleshooting Tips:</strong>
        <ul>
            <li>Ensure that the <code>mutillidae.localhost</code> server is correctly configured and accessible.</li>
            <li>Make sure the SOAP request includes the correct <code>SOAPAction</code> header.</li>
            <li>If using Burp Repeater, verify that the <code>Content-Type</code> header is set to <code>text/xml; charset=UTF-8</code>.</li>
        </ul>
    </div>

    <h2>Learn More</h2>
    <p>You can experiment by modifying the <code>message</code> parameter and observing the response. For example, send the message <code>Hello from SOAP!</code> and check if it’s echoed back correctly.</p>
</body>
</html>
